if
, and a triple or
. What solutions did they come up with?while
? while
+ if
?hike.py
¶Bit needs to hike over the mountain.
Paint only the squares directly above a blocked square.
NOTES
Look at both inputs to assess the requirements. Do we need a while loop for climbing, as opposed to a hard coded number of move statements? How do we know?
How do we break this problem up? What are the patterns that we see? Are there elements of event stream or mosaic in this problem? Are there natural subproblems, like we had with treasure.py
a moment ago?
treasure.py
¶To reach the cave, Bit must follow these instructions:
Once in the cave, navigate through the passage to the treasure (red square).
Paint the path followed green.
NOTES
Break the problem up into get-to-the-cave and find-the-treasure.
The flying has move, paint, and turn statements. What order is necessary?
Finding the treasure involves a nested if. It's essentially the same logic as scurry.py
from lab 6.
if
blocks